#include "stm32f10x.h" // Device header
#include "App_PowerCtrl.h"
#include "Int_MPU6050.h"
#include "App_MPU6050.h"
#include "Com_IMU.h"

int main(void)
{
	Dri_Uart_Init();
	MPU6050_Init();
	debug_printfln("gyro accel test");
	while (1)
	{

		App_MPU6050_ReadDataWithFilter();
		Com_IMU_GetEulerAngle(&gyroAccel, &eulerAngle, 1000);
		Com_Define_printfEulerAngle();
		Delay_ms(1000);
	}

	// App_PowerCtrl_Init();
	// uint8_t magnetic_status = 0;
	// uint8_t none_times = 0;
	// uint8_t eeprom_times = 0;

	// float eeprom_displacement = 0.0f;
	// float eeprom_part = 0.0f;
	// int32_t eeprom_circle = 0;
	// Int_24C256_LoadLatestData(&eeprom_circle, &eeprom_part, &eeprom_displacement);
	// SetCurrentDisplacement(eeprom_displacement);
	// while (1)
	// {
	// 	App_PowerCtrl_Run();
	// 	magnetic_status = Int_MT6816_GetStatus();
	// 	debug_printfln("displacement: %.2f", displacement);
	// 	debug_printfln("displacement_part: %.2f", displacement_part);
	// 	debug_printfln("circle: %d", circle);
	// 	eeprom_times ++;
	// 	if (eeprom_times >= 10)
	// 	{
	// 		eeprom_times = 0;
	// 		Int_24C256_SaveData(circle, displacement_part, displacement);
	// 	}
	// 	if (magnetic_status == 0)
	// 	{
	// 		none_times++;
	// 		debug_printfln("station.......");
	// 		if (none_times >= 20)
	// 		{
	// 			magnetic_status = 1;
	// 			none_times = 0;
	// 			App_PowerCtrl_EnterStop();
	// 		}
	// 	}
	// 	else
	// 	{
	// 		none_times = 0;
	// 	}
	// 	Delay_ms(500);
	// }
}
